/*
 * clock.h
 *
 *  Created on: Aug 1, 2013
 *      Author: killerg
 */

#ifndef CLOCK_H_
#define CLOCK_H_

#include <ctime>

struct my_clock_t {
    my_clock_t(){
        tick_len = 0;
        frame_busy = 0;
        frame_start = 0;
        frame_end = 0;
        delta = 0;
        eclipse = 0;
        tt_now = 0;

        yday_jump = false;
        mday_jump = false;
        wday_jump = false;
        year_jump = false;
        mon_jump = false;
        hour_jump = false;
        min_jump = false;
        sec_jump = false;

        week_jump = false;
    }

    bool init(int fps);

    void destroy();

    static double get_time();
    static int get_time_ms();

    void wait_frame();

    void begin_update() {
        frame_start = get_time();
    }
    void end_update() {
        frame_end = get_time();
    }


    double tick_len;
    double frame_sleep;
    double frame_busy;
    double frame_start;
    double frame_end;
    double delta;
    double eclipse;

    tm tm_now;
    time_t tt_now;

    bool yday_jump;
    bool mday_jump;
    bool wday_jump;
    bool year_jump;
    bool mon_jump;
    bool hour_jump;
    bool min_jump;
    bool sec_jump;

    bool week_jump;
};



#endif /* CLOCK_H_ */
